# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Maxime Arthaud <maxime@arthaud.me>

pkgname=zxing-cpp
pkgver=2.0.0
pkgrel=2
pkgdesc='A C++ library to decode QRCode'
arch=(x86_64)
url='https://github.com/nu-book/zxing-cpp'
license=(Apache)
depends=(gcc-libs)
makedepends=(cmake)
source=(https://github.com/nu-book/zxing-cpp/archive/v$pkgver/$pkgname-$pkgver.tar.gz
        https://github.com/zxing-cpp/zxing-cpp/commit/5142600c.patch)
sha256sums=('12b76b7005c30d34265fc20356d340da179b0b4d43d2c1b35bcca86776069f76'
            'bfc575e90fd2ce8d3d45d6a1a3cd1c50c04d206f1f5de31c6bb45f064c295887')

prepare() {
  patch -d $pkgname-$pkgver -p1 < 5142600c.patch # Fix assert
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=None \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_BLACKBOX_TESTS=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
